import uvicorn


async def app(scope, recv, send):
    assert scope['type'] == 'http'
    await send({
        'type': 'http.response.start',
        'status': 200,
        'headers': [
            [b'content-type', b'text/plain']
        ]
    })
    
    await send({
        'type': 'http.response.body',
        'body': b'hello world'
    })


if __name__ == '__main__':
    """命令行方式：uvicorn demo1:app"""
    uvicorn.run('demo1:app', host='localhost', port=24680, log_level='info')  # 参数 uvicorn.config.Config